#coding:utf-8
import re,logging,os
from google.appengine.ext import db
from google.appengine.api import memcache

class Setting(db.Model):
    webSite=db.StringProperty()
    weiboSite=db.StringProperty()
    isPassword=db.BooleanProperty(False)

class Images(db.Model):
    photoCode = db.StringProperty(multiline=True)#//图片编码
    name = db.StringProperty(multiline=True)
    mime = db.StringProperty(multiline=True)
    size = db.IntegerProperty()
    date = db.DateTimeProperty(auto_now_add=True)
    description = db.StringProperty(multiline=True)
    width = db.IntegerProperty()
    height = db.IntegerProperty()
    filetype=db.StringProperty(multiline=True)

    bf = db.BlobProperty() #binary file

    ##另一个应用的id
    otherId=db.IntegerProperty()
    isDown=db.BooleanProperty()
    updataTime=db.DateTimeProperty()
    appname=db.StringProperty()
    
  #  def put(self):
  #      super(Images,self).put()
  #      
  #  def delete(self):
  #      key=str(self.key().id())+"image"
  #      memcache.delete(key)
  #      super(Images,self).delete()
        
    @property
    def id(self):
        return str(self.key().id())
    
    @property
    def imgurl(self):
        return "http://%s/image/%s" %(os.environ['HTTP_HOST'],self.key().id())
